﻿using JetBrains.Annotations;
using PHMEE.ToolKits;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PHMEE
{
    /// <summary>
    /// 散货船
    /// </summary>
    public class Bulker : Vessel
    {

        protected Bulker()
        {
            // Required by EF Core
        }

        public Bulker(Guid id, Guid fleetId, string name, string nameen, string imo)
            : base(id, fleetId, name, nameen, imo)
        {

        }

        /// <summary>
        /// 货物容量
        /// </summary>
        [NotMapped]
        public double BulkerCapacity { get; set; }

        /// <summary>
        /// 货物类型
        /// </summary>
        [NotMapped]
        public string BulkerType { get; set; }


        /// <summary>
        /// 舱口数量
        /// </summary>
        [NotMapped]
        public int NumberOfHatches { get; set; }

        public override void SerializeProperties(Dictionary<string, object> derivedPropertiesJson)
        {
            var properties = PHMEECoreHelper.GetDerivedProperties(this);
            this.DerivedPropertiesJson = derivedPropertiesJson.Where(item => properties.Keys.Any(p => string.Equals(p, item.Key, StringComparison.OrdinalIgnoreCase))).ToDictionary();
        }

        public override void DeserializeProperties()
        {
            PHMEECoreHelper.SetDerivedProperties(this, DerivedPropertiesJson);
        }

    }
}
